Re: [SQL] 2 Table Select
От | Herouth Maoz |
---|---|
Тема | Re: [SQL] 2 Table Select |
Дата | |
Msg-id | l03130301b376cff230ad@[147.233.159.109] обсуждение исходный текст |
Ответ на | Re: [SQL] 2 Table Select ("Oliver Elphick" <olly@lfix.co.uk>) |
Список | pgsql-sql |
At 22:34 +0300 on 27/05/1999, Oliver Elphick wrote: > > select c.company_id, count(j.job_id) > from company as c, jobs as j > where c.company_id = j.company_id > group by c.company_id; If it's only the company_id that interests you, and not the company name or other details in the company table, you can give up the company table altogether. The company_id appears in the jobs table, and there is no point in selecting c.company_id when the condition was that c.company_id is equal to j.company_id. In other words, if all you need is company_id, you can use: select company_id, count(job_id) from jobs group by company_id; Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma
В списке pgsql-sql по дате отправления: